#include "ChatWindow.h"
#include "ui_ChatWindow.h"

ChatWindow::ChatWindow(QWidget *parent) :
    BaseWindow(parent),
    ui(new Ui::ChatWindow)
{
    ui->setupUi(this);
    connect(ui->SendButton,SIGNAL(clicked()),this,SLOT(OnSendClicked()));

}

void ChatWindow::OnSendClicked()
{
    mDream->SendMessage(ui->messageText->toPlainText());
    ui->messageText->clear();
}
void ChatWindow::AddMsg(QString msg)
{
    ui->chatText->append(msg);

}

void ChatWindow::OnMessageAccepted(std::string msg)
{
    ui->chatText->setText(msg.c_str());
}

ChatWindow::~ChatWindow()
{
    delete ui;
}
